// 条件查询；

const MongoClient = require('mongodb').MongoClient;
const url = 'mongodb://localhost:27017';
// const dbName = 'runoob';
const dbName = 'testmgdb';
MongoClient.connect(url, {
    useNewUrlParser: true
}, (err, client) => {
    if (err) throw err;
    const db = client.db(dbName);
    // 条件查询示例：
    var filterStr = { "press": '人民邮电出版社' }; // 查询条件
    db.collection('bookinfo').find(filterStr).toArray(function(err, docs) {
        if (err) throw err;
        console.log("找到下列记录：");
        console.log(docs);
        client.close();
    });

})